/**
 * 
 */

/**
 * @author chen.haogang
 *
 */
public class Numbers {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int x = 3;
		int y = 5;
		int power = 4;
		if((power & 0x1) == 0) {
			int sum = 0;
			int i = 0;
			for(; i < power >> 1; i += 2) {
				sum += getCoefficients(power, i) * Math.pow(x, power - i) * Math.pow(y, i >> 1) + getCoefficients(power, i) * Math.pow(y, (power - i) >> 1) * Math.pow(x, i);
				// 0x3FF = 1023
				sum &= 0x3FF;
			}
			sum += getCoefficients(power, i) * Math.pow(x, power - i) * Math.pow(y, i);
			System.out.print(sum);
		} else {
			int sum = 0;
			for(int i = 0; i < (power + 1) >> 1; i++) {
				sum += getCoefficients(power, i) * Math.pow(x, power - i) * Math.pow(y, i) + getCoefficients(power, i) * Math.pow(y, power - i) * Math.pow(x, i);
			}
			System.out.print(sum);
		}
	}

	private static void reverse(String str) {
		for(int i = str.length(); i > 0; i--) {
			System.out.print(str.charAt(i - 1));
		}
	}

	private static int getCoefficients(int n, int i) {
		int result = 1;
		for(int j = n; j > n - i; j--) {
			result *= j;
		}
		for(int j = 1; j <= i; j++) {
			result /= j;
		}
		return result;
	}
}
